package cn.icesky1stm.isblog.controller;

import cn.icesky1stm.isblog.exception.IsBlogException;
import cn.icesky1stm.isblog.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: testController <br>
 * @Description: 项目框架测试 <br>
 * @Package: cn.icesky1stm.isblog.advice <br>
 * @author: suitianmou <br>
 * @Date: 2021/6/28-14:30 <br>
 * @version: 1.0 <br>
 * @see <br>
 * @since (从产品的哪一个版本此类被添加进来 ( 可选))<br>
 * 修改历史: <br>
 * 修改时间             修改人           版本变更           修改说明<br>
 * -----------------------------------------------------<br>
 * <br>
 */
@RestController
@RequestMapping("/test")
@Slf4j
public class testController {

    /**
     * 测试异常
     */
    @RequestMapping(value = "/testException/{id}", method = RequestMethod.GET)
    public Result<Object> testException(@PathVariable Integer id ){
        if ( id == 1){
            log.info("收到id为{}的请求", id);
            return new Result<>();
        }else{
            throw new IsBlogException("发生了异常");
        }
    }
}
